using Microsoft.Practices.Unity;

namespace Sessionizer.Core.Unity
{
    public sealed class SessionFactory : ISessionFactory
    {
        private readonly IUnityContainer _container;

        public SessionFactory(IUnityContainer container)
        {
            _container = container;
        }

        public ISession Create()
        {
            return new Session(_container, _container.Resolve<ISessionStorage>(), SessionConfiguration.Empty);
        }

        public ISession Create(ISessionConfiguration configuration)
        {
            return new Session(_container, _container.Resolve<ISessionStorage>(), configuration);
        }
    }
}